package com.neo.util;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class TracingInterceptor implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation i) throws Throwable {
        System.out.println("method " + i.getMethod() + " is called on " +
                i.getThis() + " with args " + i.getArguments());
        Boolean ret = (Boolean) i.proceed();
        System.out.println("method " + i.getMethod() + " returns " + ret);
        if (ret) {
            System.out.println("系统中存在该用户");
        } else {
            System.out.println("该用户不存在");
        }
        return ret;
    }

}
